package com.kgis.fm.common.event
{
	import flash.events.Event;
	
	/**
	 *irm平台提供通用entity相关操作相关event，目前主要针对后端CommonManagementService
	 * @author zhxiaomiao
	 * */
	[Response(name="{RETURN_ID}", type="com.kgis.mvc.CommandCompletionEvent")]
	public class CommonEntityEvent extends Event {
		public static const REQUEST_ID:String = "CommonEntityEvent_Request";
		public static const RETURN_ID:String = "CommonEntityEvent_Return";
		
		//调用CommonManagementService的新增设施
		public static const TYPE_SAVE_GEOMETRYENTITY:int = 1;
		//调用CommonManagementService的根据id查找entity
		public static const TYPE_FINDENTITY_BYID:int = 2;
		//仅删除设施几何图形
		public static const TYPE_REMOVE_SPATIAL_ONLY:int = 3;
		
		public static const TYPE_REMOVE_FEATURE:int = 4;
		public static const TYPE_NEW_FEATURE:int = 5;
		public static const TYPE_REMOVE_ENTITYLIST:int = 6;
		
		//同时查询多个entityType 的entityfindByMultiEntityTypeQueryParam，参数MultiEntityTypeQueryParam
		public static const TYPE_FIND_MULTIENTITY:int = 7;
		//同时保存多个entity
		public static const TYPE_UPDATE_ENTITYLIST:int = 8;
		//查询entity时把geometry带过来
		public static const TYPE_FIND_GEOMETRYENTITY_BYID:int = 9;
		
		private var _spec:Object;
		private var _actionType:int;
		
		public function CommonEntityEvent(spec:Object, actionType:int = TYPE_FINDENTITY_BYID, type:String = null) {
			var typeId:String = type;
			if (type == null) {
				typeId = REQUEST_ID;
			}
			super(typeId);
			
			_spec = spec;
			_actionType = actionType;
		}
		
		public override function clone():Event {
			var event:CommonEntityEvent = new CommonEntityEvent(spec, actionType, type);
			return event;
		}
		
		public function get spec():Object {
			return _spec;
		}
		
		public function get actionType():int {
			return _actionType;
		}
	}
}